package com.chen.blue.controller.admin.business;

import com.chen.blue.base.FileBase;
import com.chen.blue.domain.dto.business.ContestResultDto;
import com.chen.blue.exception.e.DtoNullException;
import com.chen.blue.result.R;
import com.chen.blue.service.business.IContestApplyActiveService;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created By CLT On 2024/6/8.
 */
@SuppressWarnings("all")
@ApiSort(992)
@Api(tags = "完赛阶段-赛事结果上报模块")
@Validated
@RestController
@PreAuthorize("hasRole('ROLE_teacher')")
@RequestMapping("/contest/result")
public class ContestResultController {

    @Resource
    private IContestApplyActiveService iContestApplyActiveService;

    @PreAuthorize("hasRole('ROLE_teacher')")
    @ApiOperation(value = "竞赛结果上报(上传即上报)", notes = "竞赛结果上报(上传即上报)")
    @PostMapping("/person/apply/{id}")
    public R applyContestResult(@PathVariable("id") Long activeId, @RequestBody ContestResultDto dto) throws DtoNullException {

        return R.success(iContestApplyActiveService.addContestResult(activeId, dto));

    }

}
